package com.example.onlinereadingsystem.demos.web.controller.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.onlinereadingsystem.demos.web.dto.domain.Banner;
import com.example.onlinereadingsystem.demos.web.dto.request.NovelSearchDetailInfoParam;
import com.example.onlinereadingsystem.demos.web.dto.vo.NovelDetailInfoVo;
import com.example.onlinereadingsystem.demos.web.dto.vo.NovelSearchDetailInfoVo;
import com.example.onlinereadingsystem.demos.web.service.IndexService;
import com.example.onlinereadingsystem.demos.web.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @Description 首页接口
 * @Author ljm
 * @Date 2024/10/8
 */
@RestController
@RequestMapping("/web/index")
public class IndexController {
    @Autowired
    IndexService indexService;

    /**
     * @auther ljm
     * @create 2024/10/12
     * @describe 获取首页推荐小说信息
     */
    @GetMapping("/getIndexInfo")
    public Result<List<NovelDetailInfoVo>> getIndexInfo() {
        return indexService.getIndexInfo();
    }

    /**
     * @auther ljm
     * @create 2024/10/17
     * @describe 获取首页轮播图
     */
    @GetMapping("/getBannerList")
    public Result<List<Banner>> getBannerList() {
        return indexService.getBannerList();
    }

    /**
     * @auther ljm
     * @create 2024/11/14
     * @describe 小说搜索接口
     */
    @GetMapping("/searchNovel")
    public Result<IPage<NovelSearchDetailInfoVo>> searchNovel(NovelSearchDetailInfoParam param) {
        return indexService.searchNovel(param);
    }
}
